Returns or sets the number of tabs and the absolute tab positions of text in a RichTextBox control. Not available at design time.
Syntax
object.SelTabCount [= count]
object.SelTabs(index) [= location]
The SelTabCount and SelTabs properties syntaxes have these parts:
Part | Description |
object | An object expression that evaluates to an object in the Applies To list. |
count | An integer that determines the number of tab positions in the selected paragraph(s) or in those paragraph(s) following the insertion point. |
index | An integer that identifies a specific tab. The first tab location has an index of zero (0). The last tab location has an index equal to SelTabCount minus 1. |
location | An integer that specifies the location of the designated tab. The units used to express tab positions are determined by the scale mode of the Form object or other object containing the RichTextBox control. |
Remarks
By default, pressing TAB when typing in a RichTextBox control causes focus to move to the next control in the tab order, as specified by the TabIndex property. One way to insert a tab in the text is by pressing CTRL+TAB. However, users who are accustomed to working with word processors may find the CTRL+TAB key combination contrary to their experience. You can enable use of the TAB key to insert a tab in a RichTextBox control by temporarily switching the TabStop property of all the controls on the Form object to False while the RichTextBox control has focus. For example:
Private Sub RichTextBox1_GotFocus()
' Ignore errors for controls without the TabStop property.
On Error Resume Next
' Switch off the change of focus when pressing TAB.
For Each Control In Controls
Control.TabStop = False
Next Control
End Sub
Make sure to reset the TabStop property of the other controls when the RichTextBox control loses focus.